const Router = require('koa-router');
const router = new Router();
const tool = require('../../tools/tool')
const {db, QueryTypes} = require("../../models/db");

// 保存路线区域名称
router.post('/deliver/saveAreaName', async ctx => {
    let tenantId = ctx.user.tenantId;
    let arr = ctx.request.body.arr;
    if (arr.length > 0) {
        for (let it in arr) {
            let name = it.name;
            let carsId = it.licence;
            let id = it.id;
            await db.models['area'].update({
                tenantId,
                name,
                carsId
            }, {
                where: {
                    id: id
                }
            })
        }
    }
    return ctx.suc('已更新');
})

module.exports = router;
